package com.ruyuan.eshop.common.constants.diplomacy;

/**
 * 缓存key
 *
 * @author zhonghuashishan
 */
public abstract class AbstractRedisKeyConstants {

    private AbstractRedisKeyConstants() {
        throw new IllegalStateException("AbstractRedisKeyConstants class");
    }
    /**
     * 商品明细 缓存
     * key：skuId
     */
    public static final String PRODUCT_SKU_INFO_STRING = "PRODUCT_SKU_INFO_STRING:%s";
    /**
     * sku缓存
     * key：skuId
     */
    public static final String SKU_INFO_STRING = "SKU_INFO_STRING:%s";

    /**
     * item缓存
     * key：itemId
     */
    public static final String ITEM_INFO_STRING = "ITEM_INFO_STRING:%s";

    /**
     * 可售skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_SALE_SKU_ZSET = "SELLER_SALE_SKU_ZSET:%s";

    /**
     * 商品品类
     * key：categoryId
     */
    public static final String CATEGORY_BASE_STRING = "CATEGORY_BASE_STRING:%s";

    /**
     * 类目
     * key：类目ID
     */
    public static final String FRONT_CATEGORY_STRING = "FRONT_CATEGORY_STRING:%s";

    /**
     * 类目与商品关系
     * key：itemId
     */
    public static final String FRONT_CATEGORY_ITEM_RELATION_SET = "FRONT_CATEGORY_ITEM_RELATION_SET:%s";

    /**
     * 卖家商品价格
     * key：
     */
    public static final String SKU_PRICE_SELLER_RELATION_STRING = "SKU_PRICE_SELLER_RELATION_STRING:%s";

    /**
     * 获取sku信息key
     *
     * @param skuId
     * @return java.lang.String
     * @author zhonghuashishan
     */
    public static String getSkuInfoString(String skuId) {
        return String.format(SKU_INFO_STRING, skuId);
    }

    /**
     * 获取卖家类型下可售商品 key
     *
     * @param sellerType
     * @return java.lang.String
     * @author zhonghuashishan
     */
    public static String getSellerSaleSkuZsetKey(Integer sellerType) {
        return String.format(SELLER_SALE_SKU_ZSET, sellerType);
    }

    /**
     * 获取卖家下可售商品 key
     *
     * @param sellerId
     * @return java.lang.String
     * @author zhonghuashishan
     */
    public static String getSellerSaleSkuZsetKey(String sellerId) {
        return String.format(SELLER_SALE_SKU_ZSET, sellerId);
    }

    /**
     * 获取类目信息缓存key
     * @param id 类目ID
     */
    public static String getFrontCategoryStringKey(Integer id) {
        return String.format(FRONT_CATEGORY_STRING ,id);
    }

    /**
     * 获取类目与商品关系的缓存key
     * @param itemId
     */
    public static String getFrontCategoryItemRelationSetKey(String itemId) {
        return String.format(FRONT_CATEGORY_ITEM_RELATION_SET , itemId);
    }

}
